package edu.xidian.bdilab.jrbigdata.service.enterprise.finacial_productdetail.impl;
import edu.xidian.bdilab.jrbigdata.controller.enterprise.EnterpriseCode;
import edu.xidian.bdilab.jrbigdata.controller.response.ResponseResult;
import edu.xidian.bdilab.jrbigdata.mapper.FinancialProductMapper;
import  edu.xidian.bdilab.jrbigdata.service.enterprise.finacial_productdetail.finacial_productdetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import  edu.xidian.bdilab.jrbigdata.domain.FinancialProduct;

@Service
public class finacial_productdetailServiceimpl implements finacial_productdetailService{
    @Autowired
    FinancialProductMapper financialProductMapper;

    @Override
    public ResponseResult finacial_productdetail(String product_name) {
         ResponseResult responseResult=new ResponseResult();
       FinancialProduct financialProduct= financialProductMapper.selectById(product_name);
       if(financialProduct==null)
       {
           responseResult.setSuccess(Boolean.FALSE);
           responseResult.setCode(EnterpriseCode.PRODUCT_CHECK_FAILED.getCode());
           responseResult.setMessage(EnterpriseCode.PRODUCT_CHECK_FAILED.getMessage());
       }

       else
       {
           responseResult.setData(financialProduct);
           responseResult.setSuccess(Boolean.TRUE);
           responseResult.setCode(EnterpriseCode.PRODUCT_CHECK_SUCCESS.getCode());
           responseResult.setMessage(EnterpriseCode.Demand_CHECK_SUCCESS.getMessage());
       }

       return  responseResult;
    }

}
